var fs = require('fs');

var fileName = (path, name) => {
    var path = path || './js/';
    var obj = {};
    fs.readdir(path, (err, data) => {   //遍历当前文件夹的文件名
        if (err) throw err;
        // console.log(data);
        data.forEach(v => {
            if(v != 'forEachFile.js'){
                console.log(v);
                obj[`${v.split('.')[0]}`] = './js/' + v;
            }
        });
        console.log(obj);
        return obj;
    });
};
// fileName();
module.exports = {
    fileName
};
// export {
//     fileName
// };